package com.itheima.health.dao;

import com.itheima.health.pojo.Order;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import tk.mybatis.mapper.common.Mapper;

import java.util.Map;

/**
 * @Author: liangWeiQUQ
 * @Description: TODO
 * @DateTime: 2021/3/5 14:55
 **/
public interface OrderDao extends Mapper<Order> {
    /**
     * @Author: 传闻中的梁大侠
     * @Date: 16:14 2021/3/5
     * @Parms [id]
     * @ReturnType: com.itheima.health.entity.Result
     * @Description: 根据id查询预约订单的信息
     */
    @Select("SELECT t2.name as member, t3.name as setmeal, t1.orderDate, t1.orderType FROM t_order t1 " +
            "JOIN t_member t2 ON t1.member_id = t2.id JOIN t_setmeal t3 ON t1.setmeal_id = t3.id WHERE t1.id =#{id}")
    Map<String, Object> findById(Integer id);
    /**
       * @Author: 传闻中的梁大侠
       * @Date: 12:10 2021/3/9
       * @Parms [todayStr, todayStr1, o]
       * @ReturnType: java.lang.Object
       * @Description: 根据订单状态以及时间范围统计订单
     */
    Integer countByOrderDateAndOrderStatus(@Param("startTime")String startTime,
                                           @Param("endTime")String endTime,
                                           @Param("orderStatus")String orderStatus);
}
